package com.naiterui.ehp.bs.doctor.vo.medicine;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.naiterui.ehp.bp.utils.lang.ConfigUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "MedicineDateUnitVO", description = "用量日期单位对应值")
public class MedicineDateUnitVO implements Serializable {
    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "日期单位:小时、日、隔日等等")
    private String dateUnit;

    @ApiModelProperty(value = "分子")
    private Integer molecule;

    @ApiModelProperty(value = "分母")
    private Integer denominator;

    public String getDateUnit() {
        return this.dateUnit;
    }

    public void setDateUnit(String dateUnit) {
        this.dateUnit = dateUnit;
    }

    public Integer getMolecule() {
        return this.molecule;
    }

    public void setMolecule(Integer molecule) {
        this.molecule = molecule;
    }

    public Integer getDenominator() {
        return this.denominator;
    }

    public void setDenominator(Integer denominator) {
        this.denominator = denominator;
    }

    public static List<MedicineDateUnitVO> toVOList() {
        String dateUnitList = ConfigUtil.getString("init.medicine.dateUnitList");
        List<MedicineDateUnitVO> list = new ArrayList<>();
        String[] strArray = dateUnitList.split(",");
        for (String aStrArray : strArray) {
            String[] str = aStrArray.split("-");
            MedicineDateUnitVO vo = new MedicineDateUnitVO();
            vo.setDateUnit(str[0]);
            vo.setMolecule(Integer.parseInt(str[1]));
            vo.setDenominator(Integer.parseInt(str[2]));
            list.add(vo);
        }

        return list;
    }
}
